<?php
error_reporting(0);
session_start();

if (!isset($_SESSION["email"])) {
    if (!isset($_POST["searchConsultant"])) {
        include "includes/accessDeniedInclude.php";
    }
} else {

    include_once "src/model/Consultant.php";
    include_once "src/controller/regmanagement/AccountManager.php";
    include_once "src/controller/regmanagement/MiscellaneousManager.php";

    try {
        $user = AccountManager::getConsultant($_SESSION["email"]);
        $isSearchConsultantPage = true;
    } catch (Exception $e) {
        echo $e->getMessage();
    }
}


?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Safety & Security Consultant Registry of Texas</title>
        <style type="text/css">
            @import "js/dojo/dojox/image/resources/image.css";
            @import "js/dojo/dijit/themes/tundra/tundra.css";
            @import "js/dojo/dojox/grid/resources/Grid.css";
            @import "js/dojo/dojox/grid/resources/tundraGrid.css";
        </style>
        <link href="styles/default.css"
              rel="stylesheet"
              type="text/css"
              media="all">
        <script src="js/dojo/dojo/dojo.js"
                type="text/javascript"
                djConfig="parseOnLoad:true">
        </script>
        <script src="js/default.js" type="text/javascript"></script>
        <script type="text/javascript">
            dojo.require("dojo.parser");
            dojo.require("dijit.layout.AccordionContainer");
            dojo.require("dijit.dijit");
            dojo.require("dojox.grid.DataGrid");
            dojo.require("dojo.data.ItemFileWriteStore");
            dojo.require("dijit.form.ValidationTextBox");
            dojo.require("dijit.form.Button");
            dojo.require("dijit.Dialog");
            dojo.require("dijit.form.CheckBox");
            dojo.require("dijit.form.Form");
            dojo.require("dijit.ProgressBar");
            dojo.require("dojo.fx"); // Required for Wipe!
            dojo.require("dijit.Tooltip");

            dojo.addOnLoad(function () {
                dojo.connect(dijit.byId('consultantDetailInformationDialog'), 'hide', function () {
                    document.body.style.overflow = "";
                });

                dojo.connect(dijit.byId('defineServiceCategoriesDialog'), 'hide', function () {
                    document.body.style.overflow = "";
                });

                dojo.connect(dijit.byId('searchConsultantFAQsDialog'), 'hide', function () {
                    document.body.style.overflow = "";
                });

                refreshUserInformationLeftArea();
                refreshSearchResultsArea();

            });

            function refreshSearchResultsArea () {

                var fadeOut = dojo.fadeOut({
                    node: "consultantSearchResultArea",
                    duration: 1000
                });

                var fadeIn = dojo.fadeIn({
                    node: "consultantSearchResultArea",
                    duration: 2000
                });

                dojo.fx.chain([fadeOut, fadeIn]).play();
            }
            /*
            function manageUserProfileFormStatus () {
                var moveTopBar = "0";
                if (document.body.scrollTop > browserDiffTopBar) {
                    moveTopBar = document.body.scrollTop - browserDiffTopBar;
                }
                document.getElementById("userProfileFormStatus").style.top = moveTopBar+"px";


                var moveLeftBox = "0";
                if (document.body.scrollTop > browserDiffLeftBox) {
                    moveLeftBox = document.body.scrollTop - browserDiffLeftBox;
                }
                document.getElementById("userInformationLeftBarArea").style.top = moveLeftBox+"px";
            }
            */
        </script>
    </head>
    <body class="tundra">

        <?php
            include "includes/defineServiceCategoriesInclude.php";
            include "includes/searchConsultantFAQsInclude.php";
        ?>

        <div dojoType="dijit.Dialog"
             id="consultantDetailInformationDialog"
             title="Safety & Security Consultant Registry of Texas"
             style="display:none;width:750px;">
            <table border="0"
                   cellpadding="0"
                   cellspacing="0"
                   width="750"
                   height="400px;">
                <tbody>
                    <tr>
                        <td style="width:30px;background-image:url('images/dialogBg.png');background-repeat:repeat-y;"></td>
                        <td align="center"
                            valign="top"
                            id="consultantDetailInformationDialogArea"
                            style="background-image:url('images/loaders/bigLoader.gif');background-repeat:no-repeat;background-position:center;">
                            
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>

        <span dojoType="dojo.data.ItemFileWriteStore"
              jsId="consultantsStore"
              url="js/json/consultantsStoreStructure.json?uniqueId=<?php echo date("dmYHis"); ?>">
        </span>

        <table class="main">
            <thead>
                <tr class="mainHeader">
                    <th align="center">
                        <?php include "includes/topMenuInclude.php"; ?>
                    </th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td align="center" valign="top">
                        <table class="mainBody">
                            <tbody>
                                <tr style="height:15px;">
                                    <td style="width:175px;"></td>
                                    <td style="width:795px;"></td>
                                </tr>
                                <tr>
                                    <td valign="top">
                                        <?php include "includes/leftBarInclude.php"; ?>
                                    </td>
                                    <td valign="top" style="padding-left:20px;">
                                        <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                            <tbody>
                                                <tr>
                                                    <td class="pageMainTitle">
                                                        <div style="float:left;">
                                                            <div style="float:left;width:700px;">Search Consultants</div>
                                                            <div style="float:right;padding-right:5px;">
                                                                <a href="javascript:showSearchConsultantFAQsDialog();">
                                                                    <img src="images/icons/faqsIcon.png"
                                                                         id="faqsToolTipIcon"
                                                                         alt="faqsIcon"
                                                                         style="border:none;" />
                                                                </a>
                                                                <div id="faqsToolTip"
                                                                     dojoType="dijit.Tooltip"
                                                                     connectId="faqsToolTipIcon"
                                                                     style="display:none;">
                                                                    FAQ's
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div style="float:left;font-size:10px;">
                                                            This  registry  is  intended  to  serve  only  as  an informational  resource
                                                            for  school  districts  and  institutions  of higher education.
                                                            The inclusion of persons in this registry is not an endorsement of their
                                                            qualifications or ability to provide school safety or security consulting services.
                                                        </div>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="height:10px;"></td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <?php include "includes/consultantSearchFilterInclude.php"; ?>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td height="20"></td>
                                                </tr>
                                                <tr>
                                                    <td id="consultantSearchResultAreaStatusMessage"
                                                        style="border:2px solid #AAAAAA;text-align:center;font-family:Verdana;font-size:12px;padding:10px;font-weight:bold;">
                                                        Please specify your search criteria above.
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="background-image:url('images/loaders/bigLoader.gif');background-repeat:no-repeat;background-position:top;">
                                                        <?php include "includes/consultantSearchResultsInclude.php"; ?>
                                                    </td>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td align="center" valign="top">
                        <?php include "includes/mainFooterInclude.php"; ?>
                    </td>
                </tr>
            </tbody>
        </table>
    </body>
</html>
